<%@ taglib uri="/tld/extremecomponents" prefix="ec" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

	<script src = "../js/jquery-1.12.1.js" type = "text/javascript"></script>
	<script src = "../js/jquery.validate.js" type = "text/javascript"></script>
	<script src = "../js/messages_zh.js" type = "text/javascript"></script>
	<script src = "../js/common.js" type = "text/javascript"></script>
	
	<link href="<%=request.getContextPath() %>/css/extremecomponents.css" rel="stylesheet" type="text/css" />
	<link href="<%=request.getContextPath() %>/css/global.css" rel="stylesheet" type="text/css" />
	<title></title>
	
</head>
<body>
<c:choose>
	<c:when test="${CONDITIONMAP.flag == 'add'}">
   		<div id="current"><span style="padding-left:10px;">当前位置： &gt; 添加课程</span></div>
	</c:when>
	<c:when test="${CONDITIONMAP.flag == 'update'}">
   		<div id="current"><span style="padding-left:10px;">当前位置：&gt; 修改课程</span></div>
	</c:when>
</c:choose>
<form id="addCourseForm" name="addCourseForm" method="post">
	<table width="600" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
    	<tr>
        	<td height="30" align="center" class="xxpage">
            	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                	<tr>
                		<td width="14%" class="xxpage_td2">当前用户：</td>
                    	<td width="86%" class="xxpage_td2">
                        	<input name="userName" id="userName" type="text"  value="${USERINFO.userCode}"   readonly="true" />
							<input type="hidden" name="FLAG" value="<c:out value="${CONDITIONMAP.flag}"/>" />
							<input type="hidden" name="courseId" value="<c:out value="${LISTINFO.courseId}"/>" />
                        </td>
                    </tr> 
                    <tr>
                    	<td class="xxpage_td2">课程号：</td>
                    	<td class="xxpage_td2">
                        	<input name="courseNumber" id="courseNumber" type="text" value="<c:out value='${LISTINFO.courseNumber}'/>"  />
                        </td>
                    </tr>
                    <tr>
                    	<td class="xxpage_td2" style="color:red">课程名：</td>
                        <td class="xxpage_td2">
                        	<input name="courseName" id="courseName" type="text" value="<c:out value='${LISTINFO.courseName}'/>"  />
                        </td>
                    </tr>
				</table>
			</td>
		</tr>
	</table>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
    	<tr>
        	<td width="49%" height="40" align="right"><input id="btnadd" name="btnadd" type="button" class="btn_2" value="确认" /></td>
            <td width="2%" align="center">&nbsp;</td>
            <td align="left"><input id="reset" name="reset" type="reset" class="btn_2" value="重置" /></td>
        </tr>
	</table>
</form>
<script>

//增加/修改
	$("#btnadd").click(function() {
		var courseName = $("#courseName").val();
	    if(courseName==""){
	        alert("课程名不可为空！");
	        return false;
	    }else{
	        $.ajax({
	            type : "post",
	            dataType : "text",
	            url : "analysiscourse?ActionType=course_modify",
	            data : $("#addCourseForm").serialize(),
	            success : function(massage) {
	                if (massage == 'success') {
	                	alert("操作成功！");
	                	goTo("analysiscourse?ActionType=course");
	                }
	                if (massage == 'fail') {
	                	alert("操作失败！");
	                }
	            }
	        });
	    }
	});   

</script>
</body>
</html>